/**
 * Created by LeungZ on 2016/8/16.
 */
class ServiceSrv {
    constructor(commonSrv) {
        "ngInject";
        this._commonSrv = commonSrv;
    }

    getRCList(para,filter) {
        return this._commonSrv('get', '/ctg-imageconsole-web/rc/queryRcs',{
            perpage: para.perPage || 10,
            page: para.page,
            name: filter && filter.name,
            namesp: filter && filter.namespace,
            clusterCode: para.code
        });
    }

    getRCDetail(para) {
        return this._commonSrv('get', '/ctg-imageconsole-web/rc/queryRcDetail',{
            name: para.name,
            namesp: para.namesp,
            clusterCode: para.code
        });
    }

    updateReplicas(para){
        return this._commonSrv('post', '/ctg-imageconsole-web/rc/updateRcReplicas',{
            name: para.name,
            namesp: para.namesp,
            replicas:para.replicas,
            clusterCode: para.code
        });
    }

    //--------------------------------------dp------------------------------------

    getDPList(para,filter) {
        return this._commonSrv('get', '/ctg-imageconsole-web/deployment/queryDeployments',{
            perpage: para.perPage || 10,
            page: para.page,
            name: filter && filter.name,
            clusterCode: para.code
        });
    }

    getDPDetail(para) {
        return this._commonSrv('get', '/ctg-imageconsole-web/deployment/queryDeploymentDetail',{
            name: para.name,
            namesp: para.namesp,
            clusterCode: para.code
        });
    }

    updateReplicasDp(para){
        return this._commonSrv('post', '/ctg-imageconsole-web/deployment/updateDpReplicas',{
            name: para.name,
            namesp: para.namesp,
            replicas:para.repVal,
            clusterCode: para.code
        });
    }

    //--------------------------------------rs------------------------------------

    getRSList(para,filter) {
        return this._commonSrv('get', '/ctg-imageconsole-web/replicaset/queryReplicasets',{
            perpage: para.perPage || 10,
            page: para.page,
            name: filter && filter.name,
            clusterCode: para.code
        });

    }

    getRSDetail(para) {
        return this._commonSrv('get', '/ctg-imageconsole-web/replicaset/queryReplicasetDetail',{
            name: para.name,
            namesp: para.namesp,
            clusterCode: para.code
        });
    }
}
export default ServiceSrv